package  com.views.warSoul {
    import flash.display.*;
    import flash.geom.*;

    public class Soul extends MovieClip {

        public var isMcEnd:Boolean = false;
        public var angle:Number = 0;
        private var _playTime:int = 1;
        private var _lostTime:int = 0;
        private var _lostTimeCount:int = 0;
        private var _speed:Number = 0;
        public var DefuleScale:Number = 0;
        private var _onEnd:Function;
        private var _target:MovieClip;
        private var _omega:Number = 10;

        public function Soul(){
            this._onEnd = new Function();
            super();
        }
        public function set onEnd(_arg1:Function):void{
            this._onEnd = _arg1;
        }
        public function lostTime(_arg1:int):void{
            this._lostTime = _arg1;
            this._lostTimeCount = _arg1;
        }
        public function mcPlay():void{
            this._lostTimeCount = this._lostTime;
            this.isMcEnd = false;
        }
        public function set target(_arg1:MovieClip):void{
            this._target = _arg1;
        }
        public function get target():MovieClip{
            return (this._target);
        }
        public function move():void{
            if (this.isMcEnd == true){
                return;
            };
            if (this._lostTimeCount > 0){
                this._lostTimeCount--;
                return;
            };
            this._playTime++;
            if (this._playTime <= 1){
                this._speed = 2;
            };
            if ((((this._playTime > 0)) && ((this._playTime < 10)))){
                this._speed = (this._speed + 0.3);
                this.move1();
            };
            if ((((this._playTime >= 10)) && ((this._playTime < 20)))){
                this._speed = (this._speed + 0.4);
                this.move3();
            };
            if (this._playTime >= 20){
                this._speed = (this._speed + 0.4);
                this.move2();
            };
            var _local1:Number = (this._speed / 1000);
            if (this._playTime < 20){
                if (this.scaleX < 0.8){
                    this.scaleX = (this.scaleX + _local1);
                    this.scaleY = this.scaleX;
                };
            };
            if (this._playTime > 40){
                if (this.scaleX > 0.3){
                    this.scaleX = (this.scaleX - _local1);
                    this.scaleY = this.scaleX;
                };
            };
            if (this._playTime > 40){
                this._omega = (this._omega + 1);
            };
            if (this._speed > WarSoulData.MaxSpeed){
                this._speed = WarSoulData.MaxSpeed;
            };
            this.endState();
        }
        private function move1():void{
            var _local1:Point = WarSoulData.StartPoint;
            Moving.rocketMoveForPoint(this, _local1.x, (_local1.y - 100), this._speed, this._omega);
        }
        private function move3():void{
            var _local1:Point = WarSoulData.StartPoint;
            Moving.rocketMoveForPoint(this, (_local1.x + 100), (_local1.y - 500), this._speed, -(this._omega));
        }
        private function move2():void{
            var _local1:Point = WarSoulData.EndPoint;
            Moving.rocketMoveForPoint(this, _local1.x, _local1.y, this._speed, -(this._omega));
        }
        private function endState():void{
            var _local1:Point = WarSoulData.EndPoint;
            var _local2:Number = Moving.pointDistance(this, _local1.x, _local1.y);
            if (_local2 <= 20){
                this.x = _local1.x;
                this.y = _local1.y;
                this.rotation = 0;
                this.alpha = 0;
                this.isMcEnd = true;
                this._onEnd();
            }
        }

    }
}
